package biz;

import dao.AddressDao;
import util.DBHelper;

public class AddressBiz {
    private AddressDao dao =new AddressDao();
    public void addAddress(String uid,String receivername,String receiverphone,String receiverprovince,String receiveraddress,String status) throws BizException {
        if (receiverprovince==null||receiverprovince.trim().isEmpty() == true){
            throw new BizException("省份市不能为空");
        }


        if (receiveraddress == null||receiveraddress.trim().isEmpty() == true){
            throw new BizException("详细地址不能为空");
        }

        if (receivername==null||receivername.trim().isEmpty() == true){
            throw new BizException("收货人姓名不能为空");
        }

        if ( receiverphone.trim().length()!=11 ){
            throw new BizException("电话号码必须为11位");
        }


        dao.addAddress(uid,receivername,receiverphone,receiverprovince,receiveraddress,status);
    }

}
